package com.fenyin.samples.study.rmi.example1.client;  

import java.rmi.Naming;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.bj58.samples.study.rmi.example1.service.IHelloService;
import com.fenyin.samples.study.rmi.example1.server.Server;

/**
 *@Title:  RMI客户端程序包
 *@Description:  简单客户端
 *@Author:fengzhichao  
 *@Since:2012-9-20  
 *@Version:1.1.0
 */
public class Client {
	
	private static final Log log = LogFactory.getLog(Server.class);
	
	public static void main(String[] args){
		try {
			log.info("--------rmi客户器start-----------");
//			IHelloService helloService = (IHelloService) Naming.lookup("hello");
			//如果要从另一台启动了RMI注册服务的机器上查找hello实例   
			IHelloService helloService = (IHelloService) Naming.lookup("rmi://localhost:1099/hello");
			log.info("服务结果："+helloService.say());
		} catch (Throwable e) {
			log.info("--------rmi客户器error-----------",e);
		} 
	}
}
